package com.designpatterns.compund.compund1;

/**
 * @author Brook
 */
public class QuackCounter implements Quackable{
    Quackable duck;
    static int numberOfQuack;

    public QuackCounter (Quackable duck) {
        this.duck = duck;
    }

    @Override
    public void quack() {
        duck.quack();
        numberOfQuack++;
    }

    public static int getNumberOfQuack() {
        return numberOfQuack;
    }

    @Override
    public void registerObserver(Observer observer) {
        duck.registerObserver(observer);
    }

    @Override
    public void notifyObservers() {
        duck.notifyObservers();
    }
}
